import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] menu = new int[N];
        Map<Integer, Integer> frequencyMap = new HashMap<>();

        for (int i = 0; i < N; i++) {
            menu[i] = scanner.nextInt();
            frequencyMap.put(menu[i], frequencyMap.getOrDefault(menu[i], 0) + 1);
        }

        int maxFreq = 0;
        for (int freq : frequencyMap.values()) {
            maxFreq = Math.max(maxFreq, freq);
        }

        if (maxFreq > (N + 1) / 2) {
            System.out.println("NO");
        } else {
            System.out.println("YES");
        }

        scanner.close();
    }
}